home *** CD-ROM | disk | FTP | other *** search
- Path: library.erc.clarkson.edu!rpi!not-for-mail
- From: Kevin Lew <Kevin.Lew@Adelaide.Edu.Au>
- Newsgroups: comp.lang.c++.moderated,comp.lang.c++
- Subject: How do I return a function pointer?
- Date: 24 Mar 1996 18:32:43 -0000
- Organization: The University of Adelaide
- Sender: cppmods@netlab.cs.rpi.edu
- Approved: Dietmar.Kuehl@uni-konstanz.de
- Message-ID: <4j44gb$j3n@netlab.cs.rpi.edu>
- Reply-To: Kevin.Lew@Adelaide.Edu.Au
- NNTP-Posting-Host: netlab.cs.rpi.edu
- X-Original-Date: Sun, 24 Mar 1996 18:10:46 +1030
-
- {The following is just a duplicate of an article I just rejected with
- an corresponding comment. Note that articles posted to a moderated
- newsgroup do not appear immediately, as they need a moderator to
- approve it. Also, after this is done, the article as to be distributed
- which also takes some time. -mod}
-
- POST
- X-Mailer: Mozilla 2.0 (X11; I; SunOS 5.5 sun4c)
- To: kev@cs.adelaide.edu.au
-
- Hello there everyone,
-
- Thanx for reading me. I have a function which needs to return a pointer
- to a function but unfortunately I dont know how the header should be
- like. get_fn (see below) takes a char* argument and must return a
- pointer to a function taking no arguments and return an int. I tried
- both
- (int(*)()) get_fn(char* name) { // code here }
- and
- int(*)() get_fn(char* name) { // code here }
-
- I also tried
-
- typedef int(*)() fnptr;
-
- fnptr get_fn(char* name) { // code here }
-
- but nothing works, any help? Please email me because I don't regularly
- read the news.
-
- Kevin
-
- --
- Kevin C F Lew ,-_|\ email: kev@cs.adelaide.edu.au
- Department of Computer Science / \ phone: (08) 303 4728
- University of Adelaide \_,-*_/ fax: (08) 303 4366
- South Australia 5005 v www.cs.adelaide.edu.au/~kev
-
- [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
- [ Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm ]
- [ Moderation policy: http://www.connobj.com/cpp/guide.htm ]
- [ Comments? mailto:c++-request@netlab.cs.rpi.edu ]
-